Empty indicators for weighted fair queues

ABSTRACT

A scheduler for a network processor includes one or more scheduling queues. Each scheduling queue defines a respective sequence in which flows are to be serviced. A respective empty indicator is associated with each scheduling queue to indicate whether the respective scheduling queue is empty. By referring to the empty indicators, it is possible to avoid wasting operating cycles of the scheduler on searching scheduling queues that are empty.

CROSS REFERENCE TO RELATED PATENT APPLICATIONS

The present application is related to the following U.S. PatentApplications, each of which is hereby incorporated by reference hereinin its entirety:

-   U.S. patent application Ser. No. 10/016,518, filed Nov. 11, 2001,    titled “WEIGHTED FAIR QUEUE HAVING EXTENDED EFFECTIVE RANGE”,-   U.S. patent application Ser. No. 10/015,994, filed Nov. 11, 2001,    titled “WEIGHTED FAIR QUEUE SERVING PLURAL OUTPUT PORTS”,-   U.S. patent application Ser. No. 10/015,760, filed Nov. 11, 2001,    titled “WEIGHTED FAIR QUEUE HAVING ADJUSTABLE SCALING FACTOR”,-   U.S. patent application Ser. No. 10/004,373, filed Nov. 11, 2001,    titled “QoS SCHEDULER AND METHOD FOR IMPLEMENTING PEAK SERVICE    DISTANCE USING NEXT PEAK SERVICE TIME VIOLATED INDICATION”,-   U.S. patent application Ser. No. 10/002,416, filed Nov. 11, 2001,    titled “QoS SCHEDULER AND METHOD FOR IMPLEMENTING QUALITY OF SERVICE    WITH AGING STAMPS”,-   U.S. patent application Ser. No. 10/004,440, filed Nov. 11, 2001,    titled “QoS SCHEDULER AND METHOD FOR IMPLEMENTING QUALITY OF SERVICE    WITH CACHED STATUS ARRAY”, and-   U.S. patent application Ser. No. 10/004,217, filed Nov. 11, 2001,    titled “QoS SCHEDULER AND METHOD FOR IMPLEMENTING QUALITY OF SERVICE    ANTICIPATING THE END OF A CHAIN OF FLOWS”,

FIELD OF THE INVENTION

The present invention is concerned with data and storage communicationsystems and is more particularly concerned with a scheduler component ofa network processor.

BACKGROUND OF THE INVENTION

Data and storage communication networks are in widespread use. In manydata and storage communication networks, data packet switching isemployed to route data packets or frames from point to point betweensource and destination, and network processors are employed to handletransmission of data into and out of data switches.

FIG. 1 is a block diagram illustration of a conventional networkprocessor in which the present invention may be applied. The networkprocessor, which is generally indicated by reference numeral 10, may beconstituted by a number of components mounted on a card or “blade”.Within a data communication network, a considerable number of bladescontaining network processors may be interposed between a data switchand a data network.

The network processor 10 includes data flow chips 12 and 14. The firstdata flow chip 12 is connected to a data switch 15 (shown in phantom)via first switch ports 16, and is connected to a data network 17 (shownin phantom) via first network ports 18. The first data flow chip 12 ispositioned on the ingress side of the switch 15 and handles data framesthat are inbound to the switch 15.

The second data flow chip 14 is connected to the switch 15 via secondswitch ports 20 and is connected to the data network 17 via secondnetwork ports 22. The second data flow chip 14 is positioned on theegress side of the switch 15 and handles data frames that are outboundfrom the switch 15.

As shown in FIG. 1, a first data buffer 24 is coupled to the first dataflow chip 12. The first data buffer 24 stores inbound data framespending transmission of the inbound data frames to the switch 15. Asecond data buffer 26 is coupled to the second data flow chip 14, andstores outbound data frames pending transmission of the outbound dataframes to the data network 17.

The network processor 10 also includes a first processor chip 28 coupledto the first data flow chip 12. The first processor chip 28 supervisesoperation of the first data flow chip 12 and may include multipleprocessors. A second processor chip 30 is coupled to the second dataflow chip 14, supervises operation of the second data flow chip 14 andmay include multiple processors.

A control signal path 32 couples an output terminal of second data flowchip 14 to an input terminal of first data flow chip 12 (e.g., to allowtransmission of data frames therebetween).

The network processor 10 further includes a first scheduler chip 34coupled to the first data flow chip 12. The first scheduler chip 34manages the sequence in which inbound data frames are transmitted to theswitch 15 via first switch ports 16. A first memory 36 such as a fastSRAM is coupled to the first scheduler chip 34 (e.g., for storing dataframe pointers and flow control information as described further below).The first memory 36 may be, for example, a QDR (quad data rate) SRAM.

A second scheduler chip 38 is coupled to the second data flow chip 14.The second scheduler chip 38 manages the sequence in which data framesare output from the second network ports 22 of the second data flow chip14. Coupled to the second scheduler chip 38 are at least one andpossibly two memories (e.g., fast SRAMs 40) for storing data framepointers and flow control information. The memories 40 may, like thefirst memory 36, be QDRs. The additional memory 40 on the egress side ofthe network processor 10 may be needed because of a larger number offlows output through the second network ports 22 than through the firstswitch ports 16.

FIG. 2 schematically illustrates conventional queuing arrangements thatmay be provided for a data flow chip/scheduler pair (either the firstdata flow chip 12 and the first scheduler chip 34 or the second dataflow chip 14 and the second scheduler chip 38) of the network processor10 of FIG. 1. In the particular example illustrated in FIG. 2, the firstdata flow chip 12 and the first scheduler chip 34 are illustrated, but avery similar queuing arrangement may be provided in connection with thesecond data flow chip 14 and the second scheduler chip 38. In thequeuing arrangement for the first data flow chip 12 and the firstscheduler chip 34, incoming data frames (from data network 17) arebuffered in the input data buffer 24 associated with the first data flowchip 12 (FIG. 1). Each data frame is associated with a data flow or“flow”. As is familiar to those who are skilled in the art, a “flow”represents a one-way connection between a source and a destination.

Flows with which the incoming data frames are associated are enqueued ina scheduling queue 42 maintained in the first scheduler chip 34. Thescheduling queue 42 defines a sequence in which the flows enqueuedtherein are to be serviced. The particular scheduling queue 42 ofinterest in connection with the present invention is a weighted fairqueue which arbitrates among flows entitled to a “best effort” or“available bandwidth” Quality of Service (QoS).

As shown in FIG. 2, the scheduling queue 42 is associated with arespective output port 44 of the first data flow chip 12. It is to beunderstood that the output port 44 is one of the first switch ports 16illustrated in FIG. 1. (However, if the data flow chip/scheduler pairunder discussion were the egress side data flow chip 14 and schedulerchip 38, then the output port 44 would be one of the network ports 22.)Although only one scheduling queue 42 and one corresponding output port44 are shown, it should be understood that in fact there may be pluraloutput ports and corresponding scheduling queues each assigned to arespective port. (However, according to an alternative embodiment,disclosed in co-pending patent application Ser. No. 10/015,994, filedNov. 1, 2001, a group of output ports may be associated with eachscheduling queue 42. This co-pending patent application is incorporatedherein by reference.)

Although not indicated in FIG. 2, the first scheduler chip 34 alsoincludes flow scheduling calendars which define output schedules forflows which are entitled to a scheduled QoS with guaranteed bandwidth,thus enjoying higher priority than the flows governed by the schedulingqueue 42.

The memory 36 associated with the first scheduler chip 34 holds pointers(“frame pointers”) to locations in the first data buffer 24corresponding to data frames associated with the flows enqueued in thescheduling queue 42. The memory 36 also stores flow control information,such as information indicative of the QoS to which flows are entitled.

When the scheduling queue 42 indicates that a particular flow enqueuedtherein is the next to be serviced, reference is made to the framepointer in the memory 36 corresponding to the first pending data framefor the flow in question and the corresponding frame data is transferredfrom the first data buffer 24 to an output queue 46 associated with theoutput port 44.

A more detailed representation of the scheduling queue 42 is shown inFIG. 3. As noted above, the scheduling queue 42 is used for weightedfair queuing of flows serviced on a “best effort” basis. In a particularexample of a scheduling queue as illustrated in FIG. 3, the schedulingqueue 42 has 512 slots (each slot represented by reference numeral 48).Other numbers of slots may be employed. In accordance with conventionalpractice, flows are enqueued or attached to the scheduling queue 42based on a formula that takes into account both a length of a data frameassociated with a flow to be enqueued and a weight which corresponds toa QoS to which the flow is entitled.

More specifically, the queue slot in which a flow is placed uponenqueuing is calculated according to the formula CP+((WF×FS)/SF), whereCP is a pointer (“current pointer”) that indicates a current position(the slot currently being serviced) in the scheduling queue 42; WF is aweighting factor associated with the flow to be enqueued, the weightingfactor having been determined on the basis of the QoS to which the flowis entitled; FS is the size of the current frame associated with theflow to be enqueued; and SF is a scaling factor chosen to scale theproduct (WF×FS) so that the resulting quotient falls within the rangedefined by the scheduling queue 42. (In accordance with conventionalpractice, the scaling factor SF is conveniently defined as a integralpower of 2—i.e., SF=2^(n), with n being a positive integer—so thatscaling the product (WF×FS) is performed by right shifting.) With thisknown weighted fair queuing technique, the weighting factors assigned tothe various flows in accordance with the QoS assigned to each flowgovern how close to the current pointer of the queue each flow isenqueued. In addition, flows which exhibit larger frame sizes areenqueued farther from the current pointer of the queue, to prevent suchflows from appropriating an undue proportion of the available bandwidthof the queue. Upon enqueuement, data that identifies a flow (the “FlowID”) is stored in the appropriate queue slot 48.

As noted above, each scheduler may include a plurality of schedulingqueues. For example, 64 scheduling queues may be supported in eachscheduler. Each scheduling queue services a respective output port, or agroup of output ports as taught in the above-referenced co-pendingpatent application Ser. No. 10/015,994.

The scheduling queues may be accessed one after another in accordancewith a round robin process, to search the scheduling queues forrespective flows to be dequeued. One scheduling queue may be searchedduring each operating cycle of the scheduler. However, if the schedulingqueue that is searched during a given cycle turns out to be empty, thenthe cycle may be wasted.

It is known to provide a counter for each scheduling queue to keep trackof whether or not the scheduling queue is empty. However, operation ofeach counter may entail two increment operations (one for attachment ofa new flow, and one for reattachment of a previously attached flow) andone decrement operation (reflecting detachment of a winning flow) duringeach cycle. Thus using a counter to track whether or not a schedulingqueue is empty may adversely affect the performance of the scheduler.Moreover, providing a counter for each queue adds to the complexity andspace requirements of the scheduler design.

An improved technique for determining whether or not a scheduling queueis empty would therefore be desirable.

SUMMARY OF THE INVENTION

According to an aspect of the invention, a scheduler for a networkprocessor is provided. The scheduler includes one or more schedulingqueues, each scheduling queue adapted to define a respective sequence inwhich flows are to be serviced. The scheduler further includes one ormore empty indicators, with each empty indicator being associated with arespective scheduling queue to indicate whether the respectivescheduling queue is empty. Each empty indicator may be a bit in aregister.

According to another aspect of the invention, a method of dequeuing aflow from a scheduling queue is provided. The method includes examiningan empty indicator associated with the scheduling queue, and refrainingfrom searching the scheduling queue if the empty indicator indicatesthat the scheduling queue is empty. The method further includessearching the scheduling queue if the empty indicator indicates that thescheduling queue is not empty, and detaching from the scheduling queue awinning flow found in the searching step. The examining step may includechecking a bit in a register.

According to still another aspect of the invention, a method ofenqueuing a flow to a scheduling queue includes attaching a flow to thescheduling queue, and placing an empty indicator associated with thescheduling queue in a condition to indicate that the scheduling queue isnot empty. The placing step may include setting or resetting a bit in aregister.

According to still a further aspect of the invention, a method ofdequeuing a flow from a scheduling queue is provided. The methodincludes examining an empty indicator associated with the schedulingqueue, and refraining from searching the scheduling queue if the emptyindicator indicates that the scheduling queue is empty. The methodfurther includes searching the scheduling queue if the empty indicatorindicates that the scheduling queue is not empty. According to a furtherstep of the method, if a winning flow is found in the searching step,the winning flow is detached from the scheduling queue. According tostill a further step, if no flow is found in the searching step, theempty indicator is placed in a condition to indicate that the schedulingqueue is empty. The examining step may include checking a bit in aregister.

With the present invention, the empty status of scheduling queues istracked while minimizing the expenditure of processing and hardwareresources.

Other objects, features and advantages of the present invention willbecome more fully apparent from the following detailed description ofexemplary embodiments, the appended claims and the accompanyingdrawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of a conventional network processor in whichthe present invention may be applied;

FIG. 2 is a block diagram representation of conventional queuingarrangements provided in a data flow chip/scheduler pair included in thenetwork processor of FIG. 1;

FIG. 3 is a pictorial representation of a weighted fair queuingscheduling queue provided in accordance with conventional practices;

FIG. 4 is a schematic illustration of a manner in which empty indicatorsare examined and scheduling queues are searched in accordance with around robin process provided in accordance with the invention;

FIG. 5 is a flow chart that illustrates a process for detecting emptyscheduling queues and detaching flows from scheduling queues inaccordance with the invention; and

FIG. 6 is a flow chart that illustrates an alternative process providedin accordance with the invention for detecting empty scheduling queuesand detaching flows from scheduling queues.

DETAILED DESCRIPTION

Exemplary embodiments of the invention will now be described withreference to FIGS. 4-6.

FIG. 4 is a schematic illustration of a round robin process, provided inaccordance with the invention, whereby empty indicators are examined andscheduling queues (also referred to as “rings”) of the scheduler 49 aresearched for winning flows. It is to be understood that a “winning flow”is a flow that is closest to the current pointer of a scheduling queue.The scheduler 49 may be similar to the conventional scheduler 34 of FIG.1, but with the additional inventive features described below. In FIG.4, reference numeral 50 indicates empty indicators, each of which isassociated with a respective scheduling queue. For convenience only onescheduling queue (shown as “RING 2”) is illustrated in FIG. 4. In oneembodiment, each empty indicator 50 is constituted by a respective bitin a register (not separately shown). In general, any conventionalregister such as a shift register latch (SRL) or other storage means maybe employed for each empty indicator 50. As used herein and in theappended claims “empty indicator” does not include a counter.

It will be appreciated that the drawing of FIG. 4 only shows arelatively small portion of a larger number of empty indicators 50 thatmay be included in a scheduler in accordance with the invention. Forexample, if 64 scheduling queues are employed within a scheduler, therewill be 64 empty indicators each corresponding to a respective one ofthe 64 scheduling queues maintained in the scheduler. As stated, onlyone scheduling queue 42 is shown in FIG. 4 for the sake of simplicity.Furthermore, although a relatively large number of slots, such as 512slots, may be included in each scheduling queue 42, to simplify FIG. 4the scheduling queue 42 shown in FIG. 4 is illustrated with only about20 slots. The slots are represented by filled-in circles (e.g., 48 a),indicating that the respective slot is occupied by an entry for a flowattached to the scheduling queue 42, and by open circles (e.g., 48 b),indicating that there is no entry in the respective slot and that theslot accordingly is empty. It will be observed that the scheduling queue42 shown in FIG. 4 (indicated as being scheduling queue or ring number 2of 64 scheduling queues) has a number of filled slots so that thescheduling queue 42 is not empty. Consequently, the corresponding emptyindicator for the scheduling queue/ring 2 (represented by referencenumeral 50-2) is shown as being filled in, to indicate that thescheduling queue/ring 2 is not empty. On the other hand, other emptyindicators, such as 50-3 (which corresponds to another scheduling queue42 (not shown) represented as “Ring 3”), are open ovals, to indicatethat the corresponding scheduling queues (not shown) are empty.

During initialization of the scheduler 49, all of the empty indicators50 may be initially placed in a condition to indicate that therespective scheduling queues 42 are empty. Thenceforward, each time aflow is attached or reattached to a scheduling queue 42, thecorresponding empty indicator 50 is forced to a condition whichindicates that the corresponding scheduling queue 42 is not empty.

Placement of the empty indicators 50 into a condition which indicatesthat the respective scheduling queue 42 is empty, and dequeuing of flowsfrom the scheduling queues 42, will now be described, initially withreference to FIG. 5. FIG. 5 begins with a block 60. In block 60, thescheduler 49 proceeds with a round robin process in which the schedulingqueues 42 are traversed in sequence and are given respectiveopportunities to be serviced. Specifically, the sequence of schedulingqueues 42 is traversed to find the next “active” scheduling queue 42.

A scheduling queue 42 is considered to be “active” if it is not empty,and if at least one output port assigned to the scheduling queue 42 isnot in a backpressure condition. (The concept of backpressure is wellknown to those who are skilled in the art, and need not be explainedherein.) Thus, for the scheduling queue 42 which follows the mostrecently searched scheduling queue 42, the corresponding empty indicator50 is examined to determine whether the empty indicator 50 indicatesthat the associated scheduling queue 42 is empty. If the empty indicator50 indicates that the scheduling queue 42 is empty, then the schedulingqueue 42 is not searched, and the empty indicator 50 of the followingscheduling queue 42 is examined. However, if the empty indicator 50indicates that the scheduling queue 42 is not empty (and assuming thatat least one output port assigned to the scheduling queue 42 is not in abackpressure condition), then the scheduling queue 42 is selected forsearching. Searching of the scheduling queue (ring) 42 is indicated atblock 62 in FIG. 5. Searching of the scheduling queue 42 for a “winning”flow (i.e., the flow that is closest to the head of the schedulingqueue) may proceed in a conventional fashion. Alternatively, thescheduling queue 42 may be constituted in accordance with an inventiondisclosed in co-pending patent application Ser. No. 10/016,518, filedNov. 11, 2001, such that the scheduling queue has plural subqueues withmutually different ranges and resolutions. In this case, the pluralsubqueues may be searched in parallel to find the flow that is closestto the head of the scheduling queue. The disclosure of this copendingpatent application is incorporated herein by reference.

Following block 62 is decision block 64. In decision block 64, it isdetermined whether the search of the scheduling queue 42 (selected inblock 60 and searched in block 62) has indicated that the schedulingqueue 42 is empty. If so, then block 66 follows decision block 64. Atblock 66, the empty indicator 50 associated with the scheduling queue 42is placed in a condition to indicate that the scheduling queue 42 isempty. This may be done, for example, by setting or resetting anappropriate bit in a register. Following block 66, the procedure of FIG.5 loops back to block 60.

If at decision block 64 it is determined that the scheduling queue 42(selected in block 60 and searched in block 62) was not found to beempty, then decision block 68 follows decision block 64. At decisionblock 68 it is determined whether a flow that is entitled to scheduledservice, or another higher priority flow, is to be serviced from theoutput port corresponding to the winning flow found at block 62. Inother words, it is determined whether a higher priority flow preemptsservicing of the winning flow from the scheduling queue 42 searched atblock 62. If such is not the case, then block 70 follows decision block68. At block 70 the winning flow from the scheduling queue 42 isdetached from the scheduling queue and serviced in accordance withconventional practice. The procedure of FIG. 5 then loops back to block60.

However, if at decision block 68 it is found that the winning flow fromthe scheduling queue 42 searched at block 62 is to lose out to a higherpriority flow, then the procedure of FIG. 5 loops back to block 60 fromdecision block 68 without detaching the winning flow from the schedulingqueue 42.

In accordance with the procedure of FIG. 5, when a scheduling queue 42is searched and found to be empty, the empty indicator 50 is placed in acondition to indicate that the scheduling queue 42 is empty.Consequently, the next time the scheduling queue 42 is reached in theselection process (e.g., a round robin process), it will be possible todetermine that the scheduling queue 42 is empty by reference to theempty indicator 50 and without searching the empty scheduling queue 42.As a result, the operation cycle of the scheduler 49 may be used forsearching a scheduling queue 42 which is not known to be empty. (Ofcourse, this assumes that no flow is attached to the scheduling queue 42between the time the scheduling queue 42 is found to be empty and thenext time that it is reached in the selection process. If a flow isattached to the scheduling queue 42 in the interim, then the emptyindicator 50 associated with the scheduling queue 42 is placed in acondition to indicate that the scheduling queue 42 is not empty.)

An alternative procedure is provided in accordance with another aspectof the invention for situations in which a flow detached from ascheduling queue is the only flow that was enqueued in the schedulingqueue. This alternative procedure is illustrated by the flow chart ofFIG. 6. It will be observed that the flow chart of FIG. 6 has the sameblocks 60-70 as the flow chart of FIG. 5. Blocks 60-70 perform the samefunctions in the procedure of FIG. 6 as in the procedure of FIG. 5 andaccordingly need not be explained again. However, in the procedure ofFIG. 6, block 70 (detachment of the winning flow from the schedulingqueue 42) is followed by a block 72. At block 72, the winning flow ismasked and a further search of the scheduling queue 42 (selected inblock 60 and searched in block 62) is carried out to determined whetherthe scheduling queue 42 was empty but for the winning flow found atblock 62 and detached at block 70.

Following block 72 is a decision block 74. If it is determined atdecision block 74 that the scheduling queue 42 was empty but for theflow that was just detached, then block 66 follows block 74. As notedbefore in conjunction with FIG. 5, block 66 involves placing thecorresponding empty indicator 50 for the scheduling queue 42 in acondition to indicate that the scheduling queue 42 is empty. Followingblock 66 the procedure of FIG. 6 loops back to block 60.

However, if it is determined at decision block 74 that the flow detachedat block 70 was not the only flow enqueued in the scheduling queue 42,then the procedure of FIG. 6 loops back directly to block 60 fromdecision block 74, i.e., without placing the empty indicator 50associated with the scheduling queue 42 in a condition to indicate thatthe scheduling queue 42 is empty. (It is to be understood that in theevent that more than one frame is enqueued in the flow queuecorresponding to the flow detached at block 70, then the flow will bereattached to the scheduling queue 42 in due course according toconventional practice. Of course, upon the reattachment of the flow tothe scheduling queue 42, the empty indicator 50, which had been placedin a condition to indicate the scheduling queue 42 was empty, will onceagain be placed in a condition to indicate that the scheduling queue 42is not empty.)

The procedure of FIG. 6 is advantageous as compared to the procedure ofFIG. 5, in that, with the procedure of FIG. 5, a scheduling queue may beemptied by detachment of the last flow therefrom, without thecorresponding empty indicator being set to indicate that the schedulingqueue is empty. By contrast, with the inclusion of blocks 72 and 74 inFIG. 6, detachment of the last flow from a scheduling queue is detectedand the placement of the corresponding empty indicator in a condition toindicate that the scheduling queue is empty occurs immediately, therebysubstantially eliminating indications that a scheduling queue is notempty when in fact it is empty. (Block 64 remains desirable in theprocedure of FIG. 6, however, to deal with rare “race” conditions inwhich an empty indicator does not indicate a scheduling queue is emptyin time to avoid a false indication that the scheduling queue is notempty.) The processes of FIGS. 5 and 6 may be implemented in hardware,software or a combination thereof.

In at least one embodiment of the invention, the processes of FIGS. 5and 6 are implemented in hardware employing a suitable combination ofconventional logic circuitry such as adders, comparators, selectors,etc. Such hardware, for example, may be located within the scheduler 49(FIG. 4). A person of ordinary skill in the art may develop logiccircuitry capable of performing the inventive processes described withreference to FIGS. 5 and 6. In a software embodiment of the invention,the processes of FIGS. 5 and 6 may comprise one or more computer programproducts. Each inventive computer program product may be carried by amedium readable by a computer (e.g., a carrier wave signal, a floppydisk, a hard drive, a random access memory, etc.).

The empty indicator arrangement of the present invention provides anefficient and cost effective way of identifying empty scheduling queuesbefore they are searched. Consequently, operating cycles of a scheduleremploying the inventive empty indicators are less likely to be wasted insearching a scheduling queue that is empty.

The foregoing description discloses only exemplary embodiments of theinvention; modifications of the above disclosed apparatus and methodswhich fall within the scope of the invention will be readily apparent tothose of ordinary skill in the art. For example, in the embodimentsdescribed above, scheduling queues are maintained in a separatescheduler chip associated with a network processor. However, it is alsocontemplated that scheduling queues may be maintained in a schedulercircuit that is implemented as part of a data flow chip or as part of aprocessor chip in a network processor.

Accordingly, while the present invention has been disclosed inconnection with exemplary embodiments thereof, it should be understoodthat other embodiments may fall within the spirit and scope of theinvention as defined by the following claims.

1. A method of dequeuing a flow from a scheduling queue having an emptyindicator, the method comprising: determining if an empty indicator of ascheduling queue is set to empty wherein the empty indicator isconfigured to indicate the queue is not empty when a flow is attached orreattached to the queue; searching the scheduling queue if the emptyindicator is set to not empty; determining if the scheduling queue isempty based on the search; setting the empty indicator to empty if thesearch determines that the scheduling queue is empty; finding a flowattached to the scheduling queue if the search does not determine thatthe queue is empty; determining whether a higher priority flow preemptsservicing of the flow attached to the scheduling queue; and detachingthe flow found when the scheduling queue is searched wherein thedetached flow is a winning flow.
 2. The method of claim 1, furthercomprising selecting the scheduling queue from among a plurality ofscheduling queues in a round robin process.
 3. The method of claim 1,wherein the searching step includes searching a plurality of subqueuesincluded in the scheduling queue, the subqueues having mutuallydifferent respective ranges and resolutions.
 4. The method as recited inclaim 1, further comprising: attaching a flow to the scheduling queue;and placing the empty indicator associated with the scheduling queue ina condition to indicate that the scheduling queue is not empty.
 5. Themethod of claim 4, wherein the attaching step includes assigning theflow to a slot in the scheduling queue according to the formulaCP+((WF×FS)/SF), where: CP is a pointer that indicates a currentposition in the scheduling queue; WF is a weighting factor associatedwith the flow; FS is a size of a data frame associated with the flow;and SF is a scaling factor.
 6. The method of claim 4, wherein theplacing step includes setting a bit in a register.
 7. The method ofclaim 4, wherein the placing step includes resetting a bit in aregister.
 8. The method of claim 1, wherein, if the detaching step isperformed, a further search of the scheduling queue is performed todetermine whether any flows are enqueued in the scheduling queue otherthan the flow detached in the detaching step.
 9. The method of claim 8,wherein the empty indicator is placed in a condition to indicate thatthe scheduling queue is empty if the further search of the schedulingqueue determines that there are no flows in the scheduling queue otherthan the flow detached in the detaching step.
 10. A scheduler for anetwork processor, comprising: one or more scheduling queues, eachadapted to define a respective sequence in which flows are to beserviced; and a plurality of empty indicators, each empty indicator ofthe plurality of empty indicators being associated with a respectivescheduling queue to indicate whether the respective scheduling queue isempty; wherein the scheduler is adapted to: determine if an emptyindicator of the plurality of empty indicators is set to empty whereinthe empty indicator is configured to indicate the queue is not emptywhen a flow is attached or reattached to the respective schedulingqueue; search the scheduling queue if the empty indicator indicates thata flow is associated with the scheduling queue; determine if thescheduling queue is empty based on the search; set the empty indicatorto empty if the search determines that the scheduling queue is empty;finding a flow attached to the scheduling queue if the search does notdetermine the the scheduling queue is empty; determining whether ahigher priority flow preempts servicing of the found flow; and detachthe flow found during the search wherein the detached flow is a winningflow.
 11. A computer program product adapted to dequeue a flow from ascheduling queue, the computer program product comprising: a mediumreadable by a computer, the computer readable medium having computerprogram code executable on a computer to: determine if an emptyindicator is set to empty; search the scheduling queue if the emptyindicator indicates that a flow is associated with the scheduling queuewherein the empty indicator is configured to indicate the queue is notempty when a flow is attached or reattached to the respective schedulingqueue; determine if the scheduling queue is empty based on the search;set the empty indicator to empty if the search determines that thescheduling queue is empty; find a flow that is attached to thescheduling queue if the search determines that the scheduling queue isnot empty; determine whether a higher priority flow preempts servicingof the flow found during the search; and detach the flow found duringthe search from the scheduling queue wherein the detached flow is thewinning flow.
 12. A method of enqueuing a flow to a scheduling queue,comprising: placing an empty indicator associated with the schedulingqueue in a condition to indicate the scheduling queue is not emptywherein the empty indicator is: one of a plurality of empty indicators;and configured to indicate the queue is not empty when a flow isattached or reattached to the respective scheduling queue; attaching aflow to the scheduling queue; and placing the empty indicator in acondition to indicate that the scheduling queue is not empty; whereinplacing the empty indicator in the condition to indicate the schedulingqueue is not empty is performed due to attaching the flow to thescheduling queue; and wherein the attaching step includes assigning theflow to a slot in the scheduling queue according to the formulaCP+((WF×FS)/SF), where: CP is a pointer that indicates a currentposition in the scheduling queue; WF is a weighting factor associatedwith the flow; FS is a size of a data frame associated with the flow;and SF is a scaling factor.